var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(c, b, a) {
    if (cm.getMapId() == 303000000) {
        action1(c, b, a)
    } else {
        action2(c, b, a)
    }
}

function action1(mode, type, selection) {
    if (status == 0 && mode == 0) {
        cm.dispose();
        return
    }(mode == 1) ? status++ : status--;
    selectionLog[status] = selection;
    var i = -1;
    if (status <= i++) {
        cm.dispose()
    } else {
        if (status === i++) {
            if (cm.isQuestFinished(32624)) {} else {}
            var text = "准备好了的话，就将你的目的地告诉我！ \r\n";
            text += "#L0#前往米纳尔森林。#l\r\n";
            text += "#L1#前往水下世界。#l\r\n";
            text += "#L2#前往武陵。#l\r\n";
            if (cm.isQuestFinished(32623)) {
                text += "#L3#前往废矿。#l\r\n"
            }
            if (cm.isQuestFinished(32624)) {
                text += "#L4#前往战场。#l\r\n"
            }
            text += "\r\n#b#L5#哪里都不去。#l\r\n";
            cm.askMenu(text, 5, 2520005)
        } else {
            var reactor = "action分支" + selectionLog[1];
            eval(reactor)(mode, type, selection, i)
        }
    }
}

function action分支0(d, c, b, a) {
    if (status <= a++) {
        cm.sendNormalTalk("好，就去米纳尔森林。", 4, 2520005, false, true)
    } else {
        if (status === a++) {
            cm.warp(303000110, 0);
            cm.dispose()
        }
    }
}

function action分支1(d, c, b, a) {
    if (status <= a++) {
        cm.sendNormalTalk("好，就去水下世界。", 4, 2520005, false, true)
    } else {
        if (status === a++) {
            cm.warp(303000120, 0);
            cm.dispose()
        }
    }
}

function action分支2(d, c, b, a) {
    if (status <= a++) {
        cm.sendNormalTalk("好，就去武陵。", 4, 2520005, false, true)
    } else {
        if (status === a++) {
            cm.warp(303000130, 0);
            cm.dispose()
        }
    }
}

function action分支3(d, c, b, a) {
    if (status <= a++) {
        cm.askMenu("好，就去废矿。\r\n#b#L0# 快点出发吧。#l\r\n#L1#我等会儿再来。#l", 5, 2520005)
    } else {
        if (status === a++) {
            if (b == 1) {
                cm.dispose();
                return
            }
            cm.sendNormalTalk("小心掉落的冰菱~！！", 4, 2520005, false, true)
        } else {
            if (status === a++) {
                cm.playerMessage(5, "必须躲过障碍物，获得意志之花，然后进入顶端的传送口，才能离开这里。");
                cm.dispose();
                cm.warp(303040000, 0, false)
            }
        }
    }
}

function action分支4(d, c, b, a) {
    if (status <= a++) {
        cm.sendNormalTalk("黑色之翼必须为进攻圣地付出代价，出击！", 4, 2520005, false, true)
    } else {
        if (status === a++) {
            cm.dispose();
            cm.openNpc("次元图书馆_Ep2_成为女皇_战场")
        }
    }
}

function action分支5(d, c, b, a) {
    if (status <= a++) {
        cm.dispose()
    }
}

function action2(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            cm.askYesNo("要去圣地吗？", 4, 2520005)
        } else {
            cm.warp(303000100, 0);
            cm.dispose()
        }
    }
};